package com.mew.chess.core.game.bjl.game.common;

import java.util.Arrays;
import java.util.Map;
import java.util.stream.Collectors;

/**
 * 百人牛牛
 */
public enum BjlLinkType {

    Prepare(0),  // "准备游戏"),
    ShuffleCard(1),//洗牌
    DealCard(2),  // "发牌"),
    StartBet(3),   // "押注"),
    OpenCard(4),//"开牌"
    Payment(5);  // "赔付");

    private final int code;

    BjlLinkType(final int code) {
        this.code = code;
    }

    private final static Map<Integer, BjlLinkType> stateMap
            = Arrays.stream(BjlLinkType.values()).collect(Collectors.toMap(BjlLinkType::code, code -> code));

    public int code() {
        return this.code;
    }


    public static BjlLinkType parse(int code) {
        return stateMap.getOrDefault(code, BjlLinkType.Prepare);
    }

}
